import { getUserDepID, getCompanyID, getUserID } from '@/utils';

/** 验收入库Manage数据范围权限判断 */
export const ApplyManageTab = (curRes: Record<string, any>) => {
  if (curRes?.['/fixedassetportal/useCompanyID']) {
    return {
      useCompanyID: getCompanyID(),
      params: 'useCompanyID',
    };
  } else if (curRes?.['/fixedassetportal/useDepartmentID']) {
    return {
      useDepartmentID: getUserDepID(),
      params: 'useDepartmentID',
    };
  } else if (curRes?.['/fixedassetportal/userID']) {
    return {
      userID: getUserID(),
      params: 'userID',
    };
  } else {
    return {};
  }
};

export const DepartmentTab = (curRes: Record<string, any>) => {
  if (curRes?.['/fixedassetportal/useDepartmentID']) {
    return {
      useDepartmentID: getUserDepID(),
      params: 'useDepartmentID',
    };
  } else {
    return {};
  }
};

export const AssetMaterialManage = (curRes: Record<string, any>) => {
  if (curRes?.['/fixedassetportal/useCompanyID']) {
    return {
      useCompanyID: getCompanyID(),
      params: 'useCompanyID',
    };
  } else {
    return {};
  }
};

export const getUser = (curRes: Record<string, any>) => {
  if (curRes?.['/fixedassetportal/userID']) {
    return {
      userID: getUserID(),
      params: 'userID',
    };
  } else {
    return {};
  }
};
